/*
 * Entity.java
 *
 * Created on March 31, 2010, 4:47 PM
 *
 */

package com.absisgroup.nsc.utilities;

import java.util.List;

/**
 *
 * @author Hue
 */
public abstract class Entity {
    private final MappingInfo mappingInfo;
    private boolean bRemoved;
    private List columns;

    protected Entity(final String tableName, final String primaryKey) {
        bRemoved = false;
        columns = new java.util.ArrayList();
        mappingInfo = new MappingInfo(tableName, primaryKey);
    }

    public void remove() {
        bRemoved = true;
    }

    public boolean isRemoved() {
        return bRemoved;
    }

    protected void setModified(final String columnName) {
        if(!columns.contains(columnName)) {
            columns.add(columnName);
        }
    }

    public List getColumns() {
        return columns;
    }

    public void resetColumns() {
        columns.clear();
    }

    public MappingInfo mappingInfo() {
        return mappingInfo;
    }
}
